﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using BulldogCMS.Core.Storage;
using BulldogCMS.Core.Storage.Cache;
using BulldogCMS.Core.MVC;
using BulldogCMS.Core.Runtime.Modules;
using System.Reflection;

namespace BulldogCMS.Core.Runtime
{
    public class ApplicationContext
    {
        // application scope
        public IEnumerable<Site> Sites
        {
            get;
            internal set;
        }

        // application scope
        public IEnumerable<Templates.TemplateMeta> Templates
        {
            get;
            internal set;
        }

        // application scope
        public IEnumerable<Storage.DataTypeMeta> DataTypes
        {
            get;
            internal set;
        }

        // application scope
        public IEnumerable<Storage.Language> Languages
        {
            get;
            internal set;
        }

        public IEnumerable<IModuleAreaProvider> AreaProviders
        {
            get;
            internal set;
        }

        // application scope
        public Storage.Providers.IUniqueIdentifierProvider UniqueIdentifierProvider
        {
            get;
            internal set;
        }

        // application scope
        public IRequestContextProvider RequestContextProvider
        {
            get;
            internal set;
        }

        // application scope
        public string ApplicationPhysicalPath
        {
            get;
            internal set;
        }

        // application scope
        public Tree Tree
        {
            get;
            internal set;
        }

        public IStorageCache StorageCache
        {
            get;
            set;
        }

        public IURLResolver URLResolver
        {
            get;
            internal set;
        }

        public IEnumerable<Assembly> Assemblies
        {
            get;
            internal set;
        }

        public Templates.TemplateMeta GetTemplate(string name)
        {
            return Context.Application.Templates.Where(p => p.Name == name).FirstOrDefault();
        }


    }
}